import mysql.connector

class MySqlConn:

    def __init__(self):
        pass

    def to_connect_mysql(self):
        try:
            conn = mysql.connector.connect(
                host='172.24.30.115',
                user='ourcrm_admin',
                password='ourcrm_admin',
                database='scrm_test'
            )
            if conn.is_connected():
                print("成功连接到数据库")
        except mysql.connector.Error as e:
            print("连接失败:", e)


if __name__ == '__main__':
    conn = MySqlConn()
    conn.to_connect_mysql()